<!DOCTYPE html>
<html>
<head>
    <title></title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            &nbsp;&nbsp;
            <i-button type="ghost" @click="reload"><i class="fa fa-refresh"></i>&nbsp;刷新</i-button>
            #if($shiro.hasPermission("category:save"))
            <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
            #end
            #if($shiro.hasPermission("category:update"))
            <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
            #end
            #if($shiro.hasPermission("category:delete"))
            <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
            #end
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="category" :rules="ruleValidate" :label-width="100">
            <Form-item label="分类名称" prop="name">
                <i-input v-model="category.name" placeholder="分类名称"/>
            </Form-item>
            <Form-item label="关键字" prop="keywords">
                <i-input v-model="category.keywords" placeholder="关键字"/>
            </Form-item>
            <Form-item label="描述" prop="frontDesc">
                <i-input type="textarea" v-model="category.frontDesc" placeholder="描述"/>
            </Form-item>
            <Form-item label="级别" prop="level">
                <Radio-group v-model="category.level">
                    <Radio label="L1">
                        <span>L1</span>
                    </Radio>
                    <Radio label="L2">
                        <span>L2</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Form-item v-if="category.level == 'L2'" label="父节点" prop="parentId" style="width: 288px;">
                <i-select v-model="category.parentId">
                    <i-option value="" key="">请选择</i-option>
                    <i-option v-for="category in categoryList" :value="category.id"
                              :key="category.id">{{category.name}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="排序" prop="sortOrder">
                <Input-number :min="0" :step="1" v-model="category.sortOrder" placeholder="排序" style="width: 188px;"/>
            </Form-item>
            <Form-item label="首页展示排序" prop="showIndex">
                <Input-number :min="0" :step="1" v-model="category.showIndex" placeholder="首页展示排序"
                              style="width: 188px;"/>
            </Form-item>
            <Form-item label="显示" prop="isShow">
                <Radio-group v-model="category.isShow">
                    <Radio label="1">
                        <span>是</span>
                    </Radio>
                    <Radio label="0">
                        <span>否</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Row>
                <i-col span="16">
                    <Form-item label="banner图片" prop="bannerUrl">
                        <i-input v-model="category.bannerUrl" placeholder="banner图片" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessBannerUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageBannerUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="16">
                    <Form-item label="icon链接" prop="iconUrl">
                        <i-input v-model="category.iconUrl" placeholder="icon链接" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessIconUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageIconUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="16">
                    <Form-item label="图片" prop="imgUrl">
                        <i-input v-model="category.imgUrl" placeholder="图片" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessImgUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageImgUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="16">
                    <Form-item label="手机banner" prop="wapBannerUrl">
                        <i-input v-model="category.wapBannerUrl" placeholder="手机banner" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../sys/oss/upload" :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessWapBannerUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageWapBannerUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>
            <!--<Form-item label="类型" prop="type">-->
                <!--<Radio-group v-model="category.type">-->
                    <!--<Radio label="0">-->
                        <!--<span>0</span>-->
                    <!--</Radio>-->
                    <!--<Radio label="1">-->
                        <!--<span>1</span>-->
                    <!--</Radio>-->
                <!--</Radio-group>-->
            <!--</Form-item>-->
            <Form-item label="frontName" prop="frontName">
                <i-input type="textarea" v-model="category.frontName" placeholder="frontName"/>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<script src="${rc.contextPath}/js/shop/category.js?_${date.systemTime}"></script>
</body>
</html>